﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yxinmt.Interface
{
    public interface IControl
    {
        Guid Id { get; set; }
        string Name { get; set; }

        string FullName { get; set; }

        /// <summary>
        /// 控件
        /// </summary>
        /// <returns></returns>
        System.Windows.FrameworkElement Element { get; set; }

        /// <summary>
        /// 数据列
        /// </summary>
        /// <returns></returns>
        System.Windows.Controls.DataGridColumn Column { get; set; }

        /// <summary>
        /// 数据列
        /// </summary>
        /// <returns></returns>
        System.Windows.Controls.GridViewColumn Column2 { get; set; }

        /// <summary>
        /// 属性
        /// </summary>
        Dictionary<string, object> Property { get; set; }

        /// <summary>
        /// 事件加载
        /// </summary>
        void EventLoad();

        /// <summary>
        /// 数据加载
        /// </summary>
        void DataLoad();

        /// <summary>
        /// 获取值
        /// </summary>
        /// <returns></returns>
        object GetValue();

        /// <summary>
        /// 设置值
        /// </summary>
        /// <param name="value"></param>
        void SetValue(object value);

        /// <summary>
        /// 验证空值
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        bool ValidateNullable(out string message);

        void SetVisible(bool visible);

        void Add(System.Windows.FrameworkElement element);

        void Remove(System.Windows.FrameworkElement element);

        void SetBackgroundImage(string url);

        void SetBackgroundImage(System.Windows.Media.ImageSource imageSource);
        
        void SetBackColor(string color);

        void SetWidthHeight(double width, double height);

        void SetWidth(double width);
        void SetHeight(double height);

        void SetMargin(string margin);

        Action<object, System.Windows.RoutedEventArgs, IControl> MouseDownAction { get; set; }
        Action<object, System.Windows.RoutedEventArgs, IControl> MouseUpAction { get; set; }

        bool IsVisible { get; }

        /// <summary>
        /// 获取控件Bitmap
        /// </summary>
        /// <returns></returns>
        byte[] GetControlBitmap();

        void Clear();

        int GetCount();

        T GetItem<T>(int index) where T: System.Windows.FrameworkElement;

        T GetChild<T>() where T : System.Windows.FrameworkElement;

        IComponent GetComponent();
    }
}
